<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<table id="Categrories" class="table table-bordered">
    <colgroup>
        <col class="con0" />
        <col class="con1" />
        <col class="con0" />
        <col class="con1" />
        <col class="con0" />
    </colgroup>
    <thead>
        <tr style="background-color: rgba(0,0,0,.1);">
            <td colspan="6" style="text-align: center;font-size: 18px;"><?php echo 'Tên E-coupon: '.$info->title;?></td>
        </tr>
        <tr style="background-color: rgba(0,0,0,.2);">
            <td colspan="6" style="text-align: right;">Số lượng coupon: <?php echo $info->amount;?></td>
        </tr>
        <tr style="background-color: rgba(0,0,0,.2);">
            <td colspan="6" style="text-align: right;">Đã nhận: <?php echo $info->amount_available;?></td>
        </tr>
        <tr style="background-color: rgba(0,0,0,.2);">
            <td colspan="6" style="text-align: right;">Đã sử dụng: <?php echo $info->used;?></td>
        </tr>                
        <tr style="background-color: rgba(0,0,0,.2);">
            <td colspan="6" style="text-align: right;">Còn lại: <?php echo $info->amount - $info->amount_available;?></td>
        </tr>
            
        <tr>
            <th style="width: 8%;">STT</th>
            <th>Mã E-coupon</th>
			<th>Trạng thái</th>
            <th>User</th>
            <th>Ngày nhận</th>
            <th>Ngày sử dụng</th>
        </tr>
    </thead>
    <tbody>
    <?php $i=1; if(!in_array($data, array(null, '', '0'))):?>
    <?php foreach($data AS $el=>$le):?>
        <tr>
            <td><?php echo @$per_page * @$pageg + $i;?></td>
            <td><?php echo $le->code_coupon?></td> 
			<td>
            <?php if($le->active == 0):?>
                <span>E-coupon chưa phát</span>
            <?php elseif($le->active == 1):?>
                <span>E-coupon đã được nhận</span>
            <?php elseif($le->active == 2):?>
                <span>E-coupon đã sử dụng</span>
            <?php endif;?>
            </td>
			<td><?php echo $le->username ? $le->username : "Đang cập nhật";?></td>
            <td><?php echo $le->created ? date('d-m-Y', strtotime($le->created)) : "Đang cập nhật";?></td>
            <td><?php echo $le->time_use ? date('d-m-Y', strtotime($le->time_use)) : "Đang cập nhật";?></td>
        </tr>
    <?php $i++; endforeach;?>
    <?php endif?>
    </tbody>
</table>